package com.atguigu08._interface.exer2;

/**
 * @author NoobMaster69  * @date 2024/6/1 0001 星期六 15:01
 */
public class ComparableCircle extends Circle implements CompareObject{
    public ComparableCircle() {
    }

    public ComparableCircle(double radius) {
        super(radius);
    }

    @Override
    public int compareTo(Object o) {
        if(this == o){
            return 0;
        }
        if(o instanceof ComparableCircle){
            ComparableCircle c = (ComparableCircle) o;
            if(this.getRadius()>c.getRadius()){
                return 1;
            }else if(this.getRadius()<c.getRadius()){
                return -1;
            }else {
                return 0;
            }

        }
        throw new RuntimeException("输入的类型不匹配");
    }
}
